package com.uzai.console.web.smscode;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.uzai.console.annotation.SystemLogType;
import com.uzai.console.dto.smscode.SmsCodeDto;
import com.uzai.console.enums.OperationTypeEnum;
import com.uzai.console.enums.SystemModelEnum;
import com.uzai.console.mapper.MerBaseConfigMapper;
import com.uzai.console.mapper.SysDomainMapper;
import com.uzai.console.service.configplan.ConfigPlanService;
import com.uzai.console.service.smscode.SmsCodeService;
import com.uzai.console.vo.smscode.SmsCodeVo;
import com.uzai.console.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 系统设置|安全验证
 * @author liuqi
 * @date 2021年08月16日 15:11
 */
@Api(value = "安全验证",tags = "系统设置|安全验证")
@ApiSort(7)
@RestController
public class SmsCodeController extends BaseController {
    private Logger logger = LoggerFactory.getLogger(SmsCodeController.class);

    @Autowired
    private SmsCodeService smsCodeService;
    @Autowired
    private SysDomainMapper sysDomainMapper;
    @Autowired
    private MerBaseConfigMapper merBaseConfigMapper;
    @Autowired
    private ConfigPlanService configPlanService;

    @ApiOperation(value = "查询安全验证信息", notes = "查询安全验证信息", response = SmsCodeVo.class)
    @ApiOperationSupport(order = 1)
    @PostMapping("/smsCode/findSmsCodeInfo")
    public Object findSmsCodeInfo(){
        return smsCodeService.findSmsCode(getLoginInfo().getMerId());
    }

    @SystemLogType(model = SystemModelEnum.SmsCode, type = OperationTypeEnum.UPDATE)
    @ApiOperation(value = "保存安全验证信息", notes = "保存安全验证信息")
    @ApiOperationSupport(order = 2)
    @PostMapping("/smsCode/updateSmsCode")
    public Object updateSmsCode(@RequestBody SmsCodeDto smsCodeDto){
        smsCodeService.updateSmsCode(smsCodeDto);
        return true;
    }

}
